<style lang="less" scoped="scoped">
  .quest_content {
    width: 100%;
    padding-left: 10px;
    padding-right: 10px;
    background-color: #FFFFFF;
  }

  .qheader {
    font-size: 16px;
    height: 58px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 15px;
    border-bottom: 1px solid rgb(240, 240, 240);
  }

  ;

  .gcontent {
    font-size: 13px;
    padding: 10px;
    margin-bottom: 10px;
    position: relative;
    width: 93%;
    left: 4%
  }
</style>
<template>
  <div style="height:calc(100vh - 85px);background-color:#FFFFFF;overflow-y:auto;overflow-x:hidden;">
    <div class="qheader">
      <p>主账号管理 / 从账号管理</p>
    </div>
    <div class="gcontent">
      <Card dis-hover class="ivu-card-head-my">
        <Row>
          <Col span="8">
          <b>姓名：</b>
          <span>{{people.peopleName}}</span>
          </Col>
          <Col span="8">
          <b>4A主账号：</b>
          <span>{{people.fourA}}</span>
          </Col>
        </Row>
      </Card>
    </div>
    <div class="gcontent">
      <component ref="sonAccount" :is="'sonAccount'" :myAccount="myAccount" :page="'accountManager'"></component>
    </div>
  </div>
</template>

<script>
  import ajax from "../ajax_util"
  import Axios from 'axios'
  import expandRow from './sonAccount_expand.vue'
  import sonAccount from './applyVue/account/sonAccount.vue'

  export default {
    components: {
      expandRow,
      sonAccount
    },
    data() {
      return {
        myAccount: {},
        people: {}
      }
    },
    created: function() {
      this.getData();
    },
    methods: {
      getData() {
        //console.log("-----params-----",this.params);
        this.people = this.params.data;
        if (this.params.data.peopleIdList != undefined && this.params.data.peopleIdList != null) {
          this.peopleIdList = this.params.data.peopleIdList;
        }
        var that = this;
        var url = this.CONFIG.progress_url + '/account-manager-people';
        ajax.post({
          url: url,
          that: that,
          data: this.peopleIdList,
          success: function(data) {
            console.log("-----data--------", data);
            if (data.severs != undefined && data.severs != null) {
              for (var i = 0; i < data.severs.length; i++) {
                if (data.severs[i].peopleName === null || data.severs[i].peopleName === undefined || data.severs[
                    i].peopleName == "") {
                  data.severs[i].peopleName = that.people.peopleName;
                }
                if (data.severs[i].fourA === null || data.severs[i].fourA === undefined || data.severs[i].fourA ==
                  "") {
                  data.severs[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.dbs != undefined && data.dbs != null) {
              for (var i = 0; i < data.dbs.length; i++) {
                if (data.dbs[i].peopleName === null || data.dbs[i].peopleName === undefined || data.dbs[i]
                  .peopleName == "") {
                  data.dbs[i].peopleName = that.people.peopleName;
                }
                if (data.dbs[i].fourA === null || data.dbs[i].fourA === undefined || data.dbs[i].fourA == "") {
                  data.dbs[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.hadoops != undefined && data.hadoops != null) {
              for (var i = 0; i < data.hadoops.length; i++) {
                if (data.hadoops[i].peopleName === null || data.hadoops[i].peopleName === undefined || data
                  .hadoops[i].peopleName == "") {
                  data.hadoops[i].peopleName = that.people.peopleName;
                }
                if (data.hadoops[i].fourA === null || data.hadoops[i].fourA === undefined || data.hadoops[i]
                  .fourA == "") {
                  data.hadoops[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.hftps != undefined && data.hftps != null) {
              for (var i = 0; i < data.hftps.length; i++) {
                if (data.hftps[i].peopleName === null || data.hftps[i].peopleName === undefined || data.hftps[i]
                  .peopleName == "") {
                  data.hftps[i].peopleName = that.people.peopleName;
                }
                if (data.hftps[i].fourA === null || data.hftps[i].fourA === undefined || data.hftps[i].fourA ==
                  "") {
                  data.hftps[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.paas != undefined && data.paas != null) {
              for (var i = 0; i < data.paas.length; i++) {
                if (data.paas[i].peopleName === null || data.paas[i].peopleName === undefined || data.paas[i]
                  .peopleName == "") {
                  data.paas[i].peopleName = that.people.peopleName;
                }
                if (data.paas[i].fourA === null || data.paas[i].fourA === undefined || data.paas[i].fourA == "") {
                  data.paas[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.dacps != undefined && data.dacps != null) {
              for (var i = 0; i < data.dacps.length; i++) {
                if (data.dacps[i].peopleName === null || data.dacps[i].peopleName === undefined || data.dacps[i]
                  .peopleName == "") {
                  data.dacps[i].peopleName = that.people.peopleName;
                }
                if (data.dacps[i].fourA === null || data.dacps[i].fourA === undefined || data.dacps[i].fourA ==
                  "") {
                  data.dacps[i].fourA = that.people.fourA;
                }
              }
            }

            if (data.elseAuthes != undefined && data.elseAuthes != null) {
              for (var i = 0; i < data.elseAuthes.length; i++) {
                if (data.elseAuthes[i].peopleName === null || data.elseAuthes[i].peopleName === undefined || data
                  .elseAuthes[i].peopleName == "") {
                  data.elseAuthes[i].peopleName = that.people.peopleName;
                }
                if (data.elseAuthes[i].fourA === null || data.elseAuthes[i].fourA === undefined || data
                  .elseAuthes[i].fourA == "") {
                  data.elseAuthes[i].fourA = that.people.fourA;
                }
              }
            }
            that.myAccount = data;
          }
        })
      }
    },
    props: {
      params: {}
    }
  }
</script>
